import {
  request
} from '../utils/request';

// 标签列表
let getLabelList = (pageNum, pageSize) => {
  return request({
    url: '/label/list',
    data: {
      pageNum: pageNum,
      pageSize: pageSize
    }
  });
}

// 标签详情
let getLabelDetails = (labelId) => {
  return request({
    url: `/label/${labelId}`
  });
}

// 新增标签
let addLabel = (labelName, cardIds) => {
  return request({
    url: '/label/add',
    method: 'POST',
    data: {
      labelName: labelName,
      cardIds: cardIds
    }
  });
}

// 新增标签成员
let addLabelcard = (labelId, cardIds) => {
  return request({
    url: '/label/addCard',
    method: 'POST',
    data: {
      labelId: labelId,
      cardIds: cardIds
    }
  });
}

// 删除标签成员
let removeLabelCard = (labelId, cardIds) => {
  return request({
    url: '/label/removeCard',
    method: 'POST',
    data: {
      labelId: labelId,
      cardIds: cardIds
    }
  });
}

// 编辑标签名字
let editLabelName = (labelId, labelName) => {
  return request({
    url: '/label/edit',
    data: {
      labelId: labelId,
      labelName: labelName
    }
  });
}

// 删除标签
let removeLabel = (labelId) => {
  return request({
    url: `/label/remove/${labelId}`
  });
}

module.exports = {
  getLabelList,
  getLabelDetails,
  addLabel,
  addLabelcard,
  removeLabelCard,
  editLabelName,
  removeLabel
}